<?php
namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

class Progress extends AmisBasics
{
    public string $type        = 'progress';
    public string $type_static = 'static-progress';

    /**
     * 进度「条」的类型，可选line circle dashboard
     * @param string $mode
     * @return $this
     */
    public function mode(string $mode = 'line')
    {
        $this->mode = $mode;
        return $this;
    }

    public function className(string $className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 进度值
     * @param string $value
     * @return $this
     */
    public function value(string $value)
    {
        $this->value = $value;
        return $this;
    }

    /**
     * 占位文本
     * @param string $placeholder
     * @return $this
     */
    public function placeholder(string $placeholder)
    {
        $this->placeholder = $placeholder;
        return $this;
    }

    /**
     * 是否展示进度文本
     * @param bool $showLabel
     * @return $this
     */
    public function showLabel(bool $showLabel = true)
    {
        $this->showLabel = $showLabel;
        return $this;
    }

    /**
     * 背景是否显示条纹
     * @param bool $stripe
     * @return $this
     */
    public function stripe(bool $stripe = false)
    {
        $this->stripe = $stripe;
        return $this;
    }

    /**
     * type 为 line，可支持动画
     * @param bool $animate
     * @return $this
     */
    public function animate(bool $animate = false)
    {
        $this->animate = $animate;
        return $this;
    }

    /**
     * 进度颜色映射
     * 默认值：['bg-danger', 'bg-warning', 'bg-info', 'bg-success', 'bg-success']
     * @param $map
     * @return $this
     */
    public function map($map)
    {
        $this->map = $map;
        return $this;
    }

    /**
     * 自定义格式化内容
     * @param string $valueTpl
     * @return $this
     */
    public function valueTpl(string $valueTpl = '${value}%')
    {
        $this->valueTpl = $valueTpl;
        return $this;
    }

    /**
     * 进度条线宽度
     * line 类型为10，circle、dashboard 类型为6
     * @param int $strokeWidth
     * @return $this
     */
    public function strokeWidth(int $strokeWidth)
    {
        $this->strokeWidth = $strokeWidth;
        return $this;
    }

    /**
     * 仪表盘缺角角度，可取值 0 ~ 295
     * @param int $gapDegree
     * @return $this
     */
    public function gapDegree(int $gapDegree = 75)
    {
        $this->gapDegree = $gapDegree;
        return $this;
    }

    /**
     * 仪表盘进度条缺口位置，可选top bottom left right
     * @param string $gapPosition
     * @return $this
     */
    public function gapPosition(string $gapPosition = 'bottom')
    {
        $this->gapPosition = $gapPosition;
        return $this;
    }
}